<%-- 
    Document   : pacientUnijaTermini
    Created on : 18.5.2011, 18:36:
    Author     : Ruzin
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="com.zproekt.entity.Pacient" %>
<%@page import="com.zproekt.servis.OrdinacijaCRUD" %>
<%@page import="com.zproekt.entity.Termin" %>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<link rel="stylesheet" type="text/css" href="style.css" />

<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>Види ги сите термини за пациентот</title>
        </head>
        <body>
            <div class="head">
               <div class="text">
                    Добродојдовте на страната на стоматолошката ординација
                    
                </div>
                <div class="logo"></div>
             </div>
            <%
                if (request.getSession().getValue("permisija") == null) {
                    response.sendRedirect("index.jsp?error=true");
                }
                String permisija = request.getSession().getValue("permisija").toString();
                if (permisija.equals("user") || permisija.isEmpty()) {
                    response.sendRedirect("user.jsp?error=true");
                }
                // out.println("<h2>"+permisija+"</h2>");
            %>
            <h1><h:outputText value="Пациент и досегашни термини!"/></h1>
            <% com.zproekt.entity.Pacient pacient = OrdinacijaCRUD.getPacient(Long.valueOf(request.getParameter("id")));
                pageContext.setAttribute("pacient", pacient);
                java.util.List<Termin> termin = OrdinacijaCRUD.getTerminUnijaPacient(Long.valueOf(request.getParameter("id")));
                pageContext.setAttribute("termin", termin);
            %>
            ИМЕ:<input type="text" value="${pacient.getIme()}" name="ime"/><br/>
            ПРЕЗИМЕ:<input type="text" value="${pacient.getPrezime()}" name="prezime"/><br/>
            ЕМБГ:<input type="text" value="${pacient.getEmbg()}" name="embg"/><br/>
            <c:forEach var="termin" items="${termin}" >
                <form action="dodadiTretman.jsp" method="post">
                    <input type="text" value="${pacient.getId()}" style="display: none" name="id_pacient">
                    <input type="text" value="${termin.getId()}" name="id_termin" style="display: none"/>
                    <input type="text" value="${termin.getDatum()}" name="datum" readonly="true"/><br/>
                    <input type="text" value="${termin.getVreme()}" name="vreme" readonly="true"/><br/>
                    <input type="text" value="${termin.getTretman()}" name="tretman" readonly="true"/><br/>
                    <input type="submit" value="Додај Третман"/><br/>
                </form>
            </c:forEach>

            <br/>
            <form action="vidiGiSitePacienti.jsp">
                <input type="submit" value="Назад"/>
            </form>
            <br/>
            <form action="admin.jsp">
                <input type="submit" value="Откажи!"/>
            </form>
            <div class="footer">
                        Copyright Ruzin © 2011
         </div>
        </body>
    </html>
</f:view>
